#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <error.h>
#include "algo.h"

#define FLOAT_NUMBERS 1000
float numbers[FLOAT_NUMBERS];

const char * commands[] = {
    "0: 退出程序",
    "1: 计算平均值",
    "2: 计算标准差",
    "3: 限幅滤波算法",
    "4: 中值滤波算法",
    "5: 算术平均值滤波算法",
    "6: 滑动评价滤波算法",
    "7: 中位值平均滤波算法",
    "8: 限幅平均滤波算法",
    "9: 一阶滞后滤波算法",
    "10: 加权递归平均滤波算法",
    "11: 消抖滤波法算法",
    "12: 限幅消抖滤波算法",
    "13: 卡尔曼滤波算法"
};

void (*call_fns[])(float *, int, float *, float *) = {
    NULL,
    CalculateMean,
    CalculateStdDevi,
    LimitAmplitudeFiltering,
    MedianFiltering,
    MeanValueFiltering,
    MovingAverageFiltering,
    MedianAverageFiltering,
    LimitAmplitudeAverageFiltering,
    FirstOrderLagFiltering,
    WeightedRecursiveAverageFiltering,
    ShiverFiltering,
    LimitAmplitudeShiverFiltering,
    KalmanFiltering
};


void prepare();

void WelcomeLoading() {
    printf("==> 【⚪神启动】, loading...\n");
    printf("        * _______________#########_______________________\n");
    printf("        * ______________############_____________________\n");
    printf("        * ______________#############____________________\n");
    printf("        * _____________##__###########___________________\n");
    printf("        * ____________###__######_#####__________________\n");
    printf("        * ____________###_#######___####_________________\n");
    printf("        * ___________###__##########_####________________\n");
    printf("        * __________####__###########_####_______________\n");
    printf("        * ________#####___###########__#####_____________\n");
    printf("        * _______######___###_########___#####___________\n");
    printf("        * _______#####___###___########___######_________\n");
    printf("        * ______######___###__###########___######_______\n");
    printf("        * _____######___####_##############__######______\n");
    printf("        * ____#######__#####################_#######_____\n");
    printf("        * ____#######__##############################____\n");
    printf("        * ___#######__######_#################_#######___\n");
    printf("        * ___#######__######_######_#########___######___\n");
    printf("        * ___#######____##__######___######_____######___\n");
    printf("        * ___#######________######____#####_____#####____\n");
    printf("        * ____######________#####_____#####_____####_____\n");
    printf("        * _____#####________####______#####_____###______\n");
    printf("        * ______#####______;###________###______#________\n");
    printf("        * ________##_______####________####______________\n");
}

void UsageHint() {
    printf("[Usage]:\n");
    printf("  Command Code:\n");
    
    for (int ind = 0; ind < sizeof(commands)/sizeof(char*); ind++)
        printf("    %s\n", commands[ind]);
    fflush(stdout);
}
